import { NoSkinCellRenderer } from "../../common/item/NoSkinCellRenderer";
import { MWPropertyItemData } from "../data/MWPropertyItemData";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { EffectManager } from "../../../manager/EffectManager";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
//class MWPropertyItemRenderer
    
    export  class MWPropertyItemRenderer extends NoSkinCellRenderer
    {
        constructor()
        {
            super();
            setSize(130, 25);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            var loc1=arg1 as MWPropertyItemData;
            if (loc1) 
            {
                if (this._property == null) 
                {
                    this._property = ObjCreate.createGTextField("", 0, 2, 100, 25, this, GlobalStyle.textFormat6);
                }
                this._property.text = loc1.propertyDec;
                if (loc1.needShowArrow) 
                {
                    if (loc1.isAdvance) 
                    {
                        if (this._arrow == null) 
                        {
                            this._arrow = GlobalClass.getBitmap(ImagesConst.RangeRaise);
                            this._arrow.x = 80;
                            this._arrow.y = 2;
                        }
                        if (this._add == null) 
                        {
                            this._add = ObjCreate.createGTextField("", 90, 2, 30, 20, this, GlobalStyle.textFormat5);
                        }
                        this.addChild(this._arrow);
                        this._add.text = loc1.addNum.toString();
                    }
                }
                else 
                {
                    if (this._arrow && this._arrow.parent) 
                    {
                        this.removeChild(this._arrow);
                    }
                    if (this._add) 
                    {
                        this._add.text = "";
                    }
                }
                if (loc1.isUpgradeSucceed) 
                {
                    EffectManager.glowFilterReg(this._property, [FilterConst.taskShowTargetFilter], 0.6, 10, 5, 3);
                    if (this._arrow && this._add) 
                    {
                        EffectManager.glowFilterReg(this._add, [FilterConst.taskShowTargetFilter], 0.6, 10, 5, 3);
                        EffectManager.glowFilterReg(this._arrow, [FilterConst.taskShowTargetFilter], 0.6, 10, 5, 3);
                    }
                }
                else 
                {
                    EffectManager.glowFilterUnReg(this._property);
                    if (this._arrow && this._add) 
                    {
                        EffectManager.glowFilterUnReg(this._add);
                        EffectManager.glowFilterUnReg(this._arrow);
                    }
                }
            }
            return;
        }

        /* internal */ /* var */_property: GTextFiled;

        /* internal */ /* var */_arrow: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_add: GTextFiled;
    }
